/*
 * @Author: zhang ke
 * @Date: 2025-07-02 10:25:26
 * @LastEditors: your name
 * @LastEditTime: 2025-07-05 10:05:15
 * @Description: 
 * @FilePath: \vue3-admin\src\api\acl\menu\index.ts
 */
import request from "@/utils/request";

import type { PermissionResponseData,MenuParams } from "./type";
// 接口地址
enum API{
    ALLPERMISSION_URL = '/admin/acl/permission',
    ADDMENU_URL = '/admin/acl/permission/save',
    UPDATE_URL = '/admin/acl/permission/update',
    DELETEMENU_URL = '/admin/acl/permission/remove/'
}

//获取列表
export const reqAllPermission = ()=>{
    return request.get<any,PermissionResponseData>(API.ALLPERMISSION_URL)
}

//新增和编辑
export const reqAddOrUpdateMenu = (data:MenuParams)=>{
    if(data.id){
       return request.put<any,any>(API.UPDATE_URL,data)
    }else{
       return request.post<any,any>(API.ADDMENU_URL,data)
    }
}

//删除
export const reqRemoveMenu = (id:number)=>{
    return request.delete<any,any>(API.DELETEMENU_URL+id)
}